﻿using IcsSEMCtrl.Util.Client;
using Lifter.Device;
using Sunny.UI;
using TKT.Lifter.CIM.Lifter.Global;

namespace TKT.Lifter.CIM.Lifter.Gui.Monitor.Popups
{
    /// <summary>
    /// ADD BY YSL
    /// 提供多种警告弹窗api
    /// </summary>
    public class PopupNotice
    {
        private static LifterSEM LftSem = (LifterSEM)Naming.GetDeviceManager().GetDevice();
        /// <summary>
        /// 对话式弹窗
        /// </summary>
        /// <param name="MessageZH">中文提示消息</param>
        /// <param name="MessageEN">英文提示消息</param>
        /// <param name="PopupsType">弹窗类型</param>
        public static void DialogPopups(string MessageZH, string MessageEN, enumPopupsType PopupsType)
        {
            if (LftSem.LanguageType.Equals("zh"))
            {
                if (PopupsType.ToString().Equals("OK"))
                {
                    UIMessageDialog.ShowMessageDialog(MessageZH, UILocalize.OK, showCancelButton: false, UIStyle.Green, false, false);
                }
                else if (PopupsType.ToString().Equals("Warning"))
                {
                    UIMessageDialog.ShowMessageDialog(MessageZH, UILocalize.WarningTitle, showCancelButton: false, UIStyle.Orange, false, false);
                }
                else if (PopupsType.ToString().Equals("Error"))
                {
                    UIMessageDialog.ShowMessageDialog(MessageZH, UILocalize.ErrorTitle, showCancelButton: false, UIStyle.Red, false, false);
                }
            }
            else
            {
                if (PopupsType.ToString().Equals("OK"))
                {
                    UIMessageDialog.ShowMessageDialog(MessageEN, UILocalize.OK, showCancelButton: false, UIStyle.Green, false, false);
                }
                else if (PopupsType.ToString().Equals("Warning"))
                {
                    UIMessageDialog.ShowMessageDialog(MessageEN, UILocalize.WarningTitle, showCancelButton: false, UIStyle.Orange, false, false);
                }
                else if (PopupsType.ToString().Equals("Error"))
                {
                    UIMessageDialog.ShowMessageDialog(MessageEN, UILocalize.ErrorTitle, showCancelButton: false, UIStyle.Red, false, false);
                }
            }
        }
        /// <summary>
        /// 提示弹窗
        /// </summary>
        /// <param name="MessageZH">中文提示消息</param>
        /// <param name="MessageEN">英文提示消息</param>
        public static void TipsPopups(string MessageZH, string MessageEN)
        {
            if (LftSem.LanguageType.Equals("zh"))
            {
                UIMessageTip.ShowWarning(MessageZH, 1000, true);
            }
            else
            {
                UIMessageTip.ShowWarning(MessageEN, 1000, true);
            }
        }
    }
}
